package org.dandsoft.blackbox.laboratory.tests;

import org.dandsoft.blackbox.laboratory.tools.generator.Function;
import org.dandsoft.blackbox.laboratory.tools.generator.SignalsGenerator;
import org.dandsoft.blackbox.SignalId;

import java.util.Map;

/**
 * @author Vilyuzhanin Denis (Fin)
 */
public class StreamerTest {

    private final static int STEPS_COUNT = 10000;

    public static void main(String[] args) {
        find1();
    }

    private static void run(Function function, SignalsGenerator generator) {
        int resultCounter = 0;
        for (int time = 0; time < STEPS_COUNT; time++) {
            Map<SignalId, Integer> values = generator.generate();
            Integer result = function.getValue(values);
            if (result != null) {
                System.out.println("[" + resultCounter + "]" + result + " - " + values.toString());
                resultCounter++;
            }

            

        }
    }

    public static void find1() {
        System.out.println("========START 1========");
        Function function = Function.generateRandom(0, 10, 0.5);
        function.printFunction();
        SignalsGenerator generator = new SignalsGenerator(function.getArguments());
        run(function, generator);
        System.out.println("========FINISH 1========");
    }
}
